1. Field of the Invention
The present invention relates generally to improvements in compiling a source program in a digital data processing system, and more specifically to a method of assigning one or more external variables to a fast internal RAM (random access memory) provided in a microcomputer when compiling a source program. An object program thus generated features a markedly short run time compared with conventional ones.
2. Description of the Related Art
As is well known in the art, a microcomputer contains not only a CPU (central processing unit) logic but also memories for storing programs and data, I/O (input/output) interfaces for exchanging data with peripheral devices, and timing circuits for controlling the flow of data in the computer system. There are already dozens of different single-chip microcomputers available on the market.
Throughout the instant disclosure, the C language is referred to for discussing the present invention. However, this usage is merely exemplary and the invention is in no way limited to any particular compiler.
A microcomputer user, who obtains an object program using a compiler, is highly desirous for the compiled program to be fast in execution. On the other hand, it is a current tendency to provide a fast internal RAM in a microcomputer in order to effectively increase the system operation time within the microcomputer. However, a memory capacity of the internal RAM, which is available (viz., allocatable) to the user, is strictly limited.
A currently known approach to assigning external variables to the internal RAM is to add an identification (ID) code to external variables declared in a source program before compiling the same. That is, it is necessary for a programmer to attach the ID code (such as "hr") to the external variables which are to be assigned to the internal RAM. Therefore, a programmer must always exercise care that a resultant object program does not exceed the memory capacity assigned to the application program within the internal RAM. Further, it is very awkward that the programmer is required to attach the ID code to the variables every time the programmer prepares a source program. The above mentioned known techniques is disclosed in Japanese Laid-open Patent Application No. 2-144629.
Another known approach to assigning external variables to the internal RAM is to automatically assign the variables in order of occurrences in a source program as long as a RAM capacity assigned to a user permits. As a result, this approach has encountered the problem that an external RAM which is not expected to effectively increase the run time of a resultant object program, is undesirably assigned to the internal RAM. This known technique is disclosed in a paper entitled "User's Manual, CC78K4 Series C Compiler, Operation", Document No. U11572EJ1V0UM00 (1st edition) published by NEC Corporation, May 1996.